<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<script language="JavaScript">
<!--
function identifyNewPassword(){
	var newPass1 = document.forms["changePasswordForm"].elements["newPassword"].value;
	var newPass2 = document.forms["changePasswordForm"].elements["newPasswordAgain"].value;
    if (newPass1 != newPass2){
    	alert("两次输入的新密码不相同！请重新输入");
    	return false;
    }
    else {
    	return true;
    }
  }
-->
</script>

<logic:notPresent name="userName" scope="session">
	<logic:redirect forward="login"></logic:redirect>
</logic:notPresent>

<logic:notEqual name="userName" scope="session" value="admin">
	<logic:redirect forward="login"></logic:redirect>
</logic:notEqual>

<logic:present name="info" scope="request">
	<font color="red"><bean:write name="info" scope="request" /> </font>
</logic:present>
<html:form action="/changePasswordSubmit" focus="oldPassword">
	<table>
		<tr>
			<td>
				旧密码 :
			</td>
			<td>
				<html:password property="oldPassword" />
				<html:errors property="oldPassword" />
			</td>
		</tr>
		<tr>
			<td>
				新密码 :
			</td>
			<td>
				<html:password property="newPassword" />
				<html:errors property="newPassword" />
			</td>
		</tr>
		<tr>
			<td>
				新密码（确认） :
			</td>
			<td>
				<html:password property="newPasswordAgain" />
				<html:errors property="newPasswordAgain" />
			</td>
		</tr>
		<tr>
			<td>
				<html:submit value="修改" onclick="return identifyNewPassword();" />
			</td>
			<td></td>
		</tr>
	</table>
</html:form>
